import javax.swing.*;
import java.awt.*;

/**
 * Created by ospip on 2017/11/14.
 * Copyright (c) 2017 LLAP. All rights reserved.
 */
public class BallFrame extends JFrame {
    private BallCanvas canvas;
    private JButton btnAdd;

    public BallFrame() {
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        this.canvas = new BallCanvas();
        this.setSize(1400, 1000);

        this.setLayout(new BorderLayout());
        this.add("Center", canvas);
        btnAdd = new JButton("添加");
        btnAdd.addActionListener((e) -> {
            try {
                canvas.add();
            }
            catch (Exception ex) {
                System.out.println(ex.getMessage());
            }
        });
        this.add("South", btnAdd);
        this.setVisible(true);
    }

    public static void main(String[] args) {
        new BallFrame();
    }
}
